﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WebcamHttp
{
    public partial class HttpWebcamUserControl : UserControl
    {
        HttpWebcamVideoSource videoSource = new HttpWebcamVideoSource();

        public HttpWebcamVideoSource VideoSource
        {
            get
            {
                return videoSource;
            }
            set
            {
                videoSource = value;
            }
        }

        public HttpWebcamUserControl()
        {
            InitializeComponent();
            cameraWindow21.VideoSource = videoSource;
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            int fps = 10;
            int.TryParse(tbFPS.Text, out fps);
            videoSource.DesiredFrameRate = fps;
            videoSource.PictureUrl = tbUrl.Text;

            videoSource.OpenVideoSource();
        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            videoSource.CloseVideoSource();
        }
    }
}
